package com.yjd.comm.util;

import com.yjd.comm.enums.RepaymentReportStatus;
import com.yjd.comm.enums.StagesStatusEnum;
import com.yjd.comm.enums.OrderShowStatusEnum;

/**
 * 用户展示状态操作工具类
 * Created by yangchangyan on 2018/2/12.
 */
public class OrderShowStatusUtil {

    /**
     * 将系统订单状态转换为用户展示状态
     */
    public static OrderShowStatusEnum toOrderShowStatus(StagesStatusEnum currentStatus){

        switch (currentStatus) {
            case APPLY_SUCCESS:{return OrderShowStatusEnum.ODR_ACCEPT;}
            case MERCHANT_HANDING:{return OrderShowStatusEnum.ODR_AUDITING;}
            case REPAYMENTING:{return OrderShowStatusEnum.ODR_REPAYMENTING;}
            case MERCHANT_CONFIRM_CANCEL:{return OrderShowStatusEnum.ODR_ACCEPT;}
            case REPAYMENED:{return OrderShowStatusEnum.ODR_REPAYMENED;}
            case LOAN_APPLY:{return OrderShowStatusEnum.ODR_AUDITING;}
            case MERCHANT_REFUSAL:{return OrderShowStatusEnum.ODR_REFUSE;}
            case MYSEFL_CANCEL:{return OrderShowStatusEnum.ODR_CANCEL;}
            case MERCHANT_CANCEL:{return OrderShowStatusEnum.ODR_CANCEL;}
            case INVALID:{return OrderShowStatusEnum.ODR_CANCEL;}
            case FUND_REFUSE:{return OrderShowStatusEnum.ODR_REFUSE;}
        }

        throw new IllegalArgumentException("非法状态");
    }

    /**
     * 将系统还款报表状态转换为用户展示状态
     */
    public static OrderShowStatusEnum toRepaymentShowStatus(RepaymentReportStatus currentStatus){

        if(null == currentStatus){
            return OrderShowStatusEnum.RPT_UNKNOWN;
        }

        switch (currentStatus) {
            case PERIORD_NONE_CLEAN:{return OrderShowStatusEnum.RPT_NONE_CLEAN;}
            case PERIORD_CLEAN:{return OrderShowStatusEnum.RPT_CLEAN;}
            case ALL_CLEAN:{return OrderShowStatusEnum.RPT_ALL_CLEAN;}
            case OVERDUE:{return OrderShowStatusEnum.RPT_OVERDUE;}
            default:{return OrderShowStatusEnum.RPT_UNKNOWN;}
        }
    }
}